package com.imooc.task;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class TestTask {

	private static final SimpleDateFormat dateFormat = 
			new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	// 每过3秒执行一次
	// @Scheduled(fixedRate = 3000)
	public void reportCurrentTime(){
		System.out.println("当前时间：" + dateFormat.format(new Date()));
	}
}
